//
//  EnemyBullet.h
//  airfight
//
//  Created by aaron more on 12-11-16.
//  Copyright (c) 2012年 moonriver. All rights reserved.
//

#ifndef airfight_EnemyBullet_h
#define airfight_EnemyBullet_h

#include "EntitySprite.h"

enum enemyBullet_toDestoryFlag
{
    ENEMYBULLET_DESTROY_COLLISION = 1,
    ENEMYBULLET_DESTROY_OUT = 2
};


class EnemyBulletSprite : public EntitySprite
{
    CC_SYNTHESIZE(std::string,m_pID,ID);
    CC_SYNTHESIZE(int,m_pType,Type); //子弹轨迹类型
    CC_SYNTHESIZE(int,m_pDamage,Damage); //破坏值
    CC_SYNTHESIZE(int,m_pFrequency,Frequency); //发射频率
    CC_SYNTHESIZE(int,m_pSpeed,Speed); //移动速度
    CC_SYNTHESIZE(float,m_pDuration,Duration); //单次移动持续时间
    CC_SYNTHESIZE(int,m_pAngle,Angle); //发射角度
    CC_SYNTHESIZE(int,m_pGroup_num,Group_num); //一组发射数量
    CC_SYNTHESIZE(int,m_pGroup_interval,Group_interval); //一组发射数量
    CC_SYNTHESIZE(int,m_pBegin,Begin); //发射时机
    CC_SYNTHESIZE(int,m_pIsUse,IsUse); //是否在场景中
    
private:
    CCSpriteBatchNode *batch;
    CCSize screenSize;
    
protected:
    CCPoint m_pFirePoint; //发射点
    
public:
    EnemyBulletSprite();
    virtual ~EnemyBulletSprite(); 
    
    inline CCPoint getFirePoint() { return m_pFirePoint; }
    inline void setFirePoint(int x,int y) { m_pFirePoint = CCPointMake(x,y); }
    
    bool init();
    void onEnter();
    void update(float dt);
    
    void handleContact(ENTITY_TYPE type, CCDictionary *effect);
    
    SPRITE_CREATE_FUNC(EnemyBulletSprite)
};




#endif
